package com.itheima.dao;

import com.itheima.dimain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author cxl
 * @date 2020-02-11 20:44
 */

public interface UserDao {

    @Select("select * from user")
    List<User> finAll();
    @Select("select * from user where id=#{userId}")
    User findById(Integer userId);
    @Update("update user set username=#{username},password=#{password},age=#{age},sex=#{sex},email=#{email} where id=#{id}")
    void updateUser(User user);
    @Delete("delete from user where id=#{userId}")
    void deleteUser(Integer id);
    @Insert("insert into user values (null,#{age},#{username},#{password},#{email},#{sex})")
    void addUser(User user);
}
